package cn.itsource.romate.fallback;

import cn.itsource.pojo.api.DriverResult;
import cn.itsource.result.R;
import cn.itsource.romate.api.DriverApi;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * 📖：beishan
 * 🗓️：2024/4/18 18:56
 * =====================
 */
@Component
public class DriverFallback implements FallbackFactory<DriverApi> {
    @Override
    public DriverApi create(Throwable cause) {
        return new DriverApi() {
            @Override
            public R<DriverResult> getDriverSummary(Long driverId) {
                cause.printStackTrace();
                return R.error("获取司机信息异常");
            }
        };
    }
}
